
//加载一个模块，名字叫gulp
var gulp = require("gulp");
var uglify = require("gulp-uglify");
var clean = require("gulp-clean-css");
var connect = require("gulp-connect");

gulp.task("minjs",function(){
	gulp.src("./js/src/*.js").pipe(uglify()).pipe( gulp.dest("./js/min") );
});

gulp.task("mincss",function(){
	gulp.src("./css/src/*.css").pipe(clean()).pipe( gulp.dest("./css/min") );
});

gulp.task("refreshHTML",function(){
	gulp.src("./*.html").pipe(connect.reload());
})

gulp.task("auto",function(){
	
	connect.server({
		livereload: true
	});
	
	gulp.watch("./js/src/*.js",["minjs"]);
	gulp.watch("./css/src/*.css",["mincss"]);
	gulp.watch("./*.html",["refreshHTML"]);
});
